import { createApp } from "vue";
import App from "@/App.vue";
import { setupStore } from "@/store";
import { setupGlobCom } from "@/components";

import { setupElementPlus } from "@/plugins/elementPlus";
import { setupFormCreate } from "@/plugins/formCreate";
import router, { setupRouter } from "@/router";

// 引入unocss css
import "@/plugins/unocss";

// 导入全局的svg图标
import "@/plugins/svgIcon";

// 引入全局样式
import "@/styles/index.scss";

// 创建实例
const setupAll = async () => {
  const app = createApp(App);
  // 注册状态管理
  setupStore(app);
  // 注册全局组件
  setupGlobCom(app);

  setupElementPlus(app);
  // 动态表单，表单设计器
  setupFormCreate(app);
  // 注册路由
  setupRouter(app);
  await router.isReady();

  app.mount("#app");
};

setupAll();
